<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>水平垂直居中的实现</title>
  </head>
  <style>
    .container {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 300px;
      width: 300px;
      background: #f00;
    }

    .box {
      width: 100px;
      height: 100px;
      background: #0f0;
    }
  </style>
  <body>
    <div class="container">
      <div class="box"></div>
    </div>
  </body>
</html>
<script></script>
